home *** CD-ROM | disk | FTP | other *** search
- /* Set layout to block format in an AmigaGuide compatible fashion with leading user's layout for 640 pixel wide screens
-
- 25-Jan-01
- Does not use quotes, double and so on as leading chars
- Variable leftmost with righmost replaced (brain damaged?)
- */
-
- BAREED_HOST = GetClip('BAREED')
-
- IF BAREED_HOST = '' THEN DO
- CALL SetClip('BAREED') /* Remove from ClipNode */
- EXIT 5
- END
-
- ADDRESS VALUE BAREED_HOST
-
- CALL SetClip('BAREED') /* Remove from ClipNode */
-
- OPTIONS RESULTS
-
- /* ------------------- MAIN ---------------- */
-
- /* Layout is set here to 640 pixel per line (VGA) */
-
- 'Set Error Off' /* Turn off BareED's trap handling */
- 'Set Echo Off' /* Turn off BareED's I/O reports */
-
- rightmost = 640
-
- rightmost = rightmost - 4 /* Left window border has got 4 pixels */
- rightmost = rightmost - 18 /* Right window border has got 18 pixels */
- rightmost = rightmost - 2 /* BareED reserves 1 pixel in front and one pixel behind a text line */
- Get Charwidth ' ' /* Get width of a space in number of pixels */
- space = RESULT /* We now have got the amount of space characters a line can contain */
- rightmost = rightmost - space /* Due to uncoform AmigaGuide layout */
-
- numchars = rightmost % space /* Get amount of space characters that fit into a line */
-
- Set Margin Right numchars /* Set rightmost position */
-
- Get Current Char /* Try to get an ASCII character */
- currchar = RESULT
- textline = '' /* An empty line! */
-
- /* Fill up empty line with white spaces and other layout characteristics */
- DO WHILE C2D(currchar) < 33
- textline = textline || currchar
- Move Cursor Right
- Get Current Char
- currchar = RESULT
- END
-
- terminate = 0
- len = LENGTH( textline) /* Length in number of characters */
- Get Cursor Y
- thisline = RESULT
-
- /* Make the layout but care about a user's own made (for example a tab in front of a line) */
- DO WHILE terminate = 0
- Layout Guide /* Layout current line */
- Move Cursor Down /* Move cursor to next line */
- Move Cursor Linestart /* Move cursor to line start */
- Get Cursor Y /* Ask if the current line is the same as the last one */
- IF RESULT == thisline THEN
- BREAK /* If so, quit */
- thisline = RESULT /* Else, remember */
-
- Get Current Line /* Get contents of the existing line */
- terminate = RC /* Check for error */
- IF terminate ~= 0 THEN /* If error (linefeed or archive's end) then */
- BREAK /* break */
-
- /* Else drop user's line intro */
- DO i = 1 TO len
- c = SUBSTR( textline, i, 1)
- Put Char c
- END
- END
-
- EXIT
-
- /* Demo line - point cursor to the first character of the " This is a ...." and watch what BareED does .....
- ^
-
- This is a very loooooong line used as a simple example for BareED's layout mechanism and the button interface (knob-bank)
- of BareED which can be used to use this script as an example.
-
- demo line end */